package com.rabbiter.association.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.ReadConverterContext;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.metadata.data.WriteCellData;

public class UserTypeConverter implements Converter<Integer> {
    @Override
    public Class<?> supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public Integer convertToJavaData(ReadConverterContext<?> context) {
        return null; // 导入时使用
    }

    @Override
    public WriteCellData<?> convertToExcelData(WriteConverterContext<Integer> context) {
        switch(context.getValue()) {
            case 0: return new WriteCellData<>("管理员");
            case 1: return new WriteCellData<>("社团管理员");
            case 2: return new WriteCellData<>("用户");
            default: return new WriteCellData<>("未知身份");
        }
    }
}